const Components = require('unplugin-vue-components/webpack')
const { AntDesignVueResolver, ElementPlusResolver } = require('unplugin-vue-components/resolvers')
module.exports = {
    configureWebpack: {
        plugins: [
            Components({
                resolvers: [
                    AntDesignVueResolver(),
                    ElementPlusResolver()
                ],
                // 加上下面这一行作为配置项即可
                directoryAsNamespace: true,
            }),
        ],
        performance: {
            hints: 'warning',
            // 入口起点的最大体积
            maxEntrypointSize: 50000000,
            // 生成文件的最大体积
            maxAssetSize: 30000000,
            // 只给出 js 文件的性能提示
            assetFilter: function (assetFilename) {
                return assetFilename.endsWith('.js')
            }
        }
    },
    // 判断是否是开发模式，不是就修改路径 ./
    publicPath: process.env.NODE_ENV === 'development'
        ? '/' : './',
    // 编译后自动打开
    devServer: {
        proxy: {
            '/api': {
                target: 'http://127.0.0.1:8000/',
                changeOrigin: true,
                pathRewrite: {
                    '^/api': '/api'
                }
            }
        }

    }
}